@extends('admin.base.index')

@section('content')
                <div class="block-area" id="defaultStyle">
                    <h3 class="block-title">分类列表</h3>
                    <form action="/admin/type" method='post' name='myform'>
                    {{ csrf_field() }}
                    {{ method_field('delete') }}
                    </form>
                    <form action="/admin/type" method='get'>
                       <div class='media-body'>
                            <input type='text' name='name'>  
                              <input type='submit' class='btn' value='搜索'>  
                        </div>
                        
                          
                        
                    </form>
                   <!--  <form action='/demo4' method='get'>
                        <div class='media-body'>
                            姓名：<input type='text' class='form-control m-b-5' name='name'>
                        </div>
                        <div>
                            性别：<select name='sex' class='form-control m-b-5'>
                                <option value=''>----全部----</option>
                                <option value='1'>----男----</option>
                                <option value='2'>----女----</option>
                            </select>
                        </div>
                        <input type='submit' class='btn' value='搜索'>
                    </form> -->
                    <table class="table tile">
                        <thead>
                            <tr>
                                <th>No.</th>
                                <th>分类名</th>
                                <th>path</th>
                                <th>upid</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                         @foreach ($list as $v)
                                <tr>
                                     <td>{{ $v->id }}</td>
                                    <td>{{ $v->name }}</td>
                                    <td>{{ $v->path }}</td>
                                    <td>{{ $v->upid }}</td>
                                    <td>
                                        <a href="javascript:doDel({{ $v->id }})" class='btn'>删除</a>
                                        <a href="{{ url('admin/type') }}/{{ $v->id }}/edit" class='btn'>修改</a>
                                        <a href="{{ url('admin/typeSon').'/'.$v->id }}" class='btn'>添加子类</a>

                                    </td>


                                </tr>
                            @endforeach 
                        </tbody>
                    </table>
                    {{ $list->appends($where)->links() }}
                </div>
                <script type="text/javascript">
                    function doDel(id)
                    {
                        if(confirm('确定要删除吗?')){
                            var form=document.myform;
                            form.action='/admin/type/'+id;
                            form.submit();
                        }

                    }
                </script>
@endsection
